#ifndef EASY_XML_H
#define EASY_XML_H

struct exml_attr
{
  char *name;
  char *value;
  struct exml_attr *prev;
  struct exml_attr *next;
};

struct exml_node
{
  char *name;
  char *value;
  struct exml_attr *attrs;

  struct exml_node *parent;
  struct exml_node *child;
  struct exml_node *last_child;
  struct exml_node *prev;
  struct exml_node *next;
};

/** load a string to xml node
	@param s xml string
	@return xml node or NULL
*/
struct exml_node *
exml_load_string (const char *s);


/** find first child xml node from given node
	@param node xml node
	@param name xml node name
	@return xml node or NULL
*/
struct exml_node *
exml_find (struct exml_node *node, const char *name);

/** get next node*/
struct exml_node *
exml_next (struct exml_node *node);

/** get previous node*/
struct exml_node *
exml_prev (struct exml_node *node);

void exml_delete(struct exml_node *node);

void *exml_malloc(size_t size);

void exml_free(void *ptr);

void *exml_realloc(void *ptr, size_t size);



char *
exml_strdup(const char *s);

#endif
